aggregation should count distinct values excluding null